//
//  GaiaEnums.swift
//  Nexs
//  定义蓝牙协议命令
//
//  Created by roni on 2025/7/29.
//

import Foundation

public enum GaiaCommandType: UInt16 {
    // freetalkie 命令
    // 文档：https://applink.feishu.cn/client/message/link/open?token=AmdkCt6BG8ABaIm45y4TgAM%3D
    case micAudioData = 0x5D01 // 设备向APP上报的音频数据
    case audioSendStart = 0x5D02 // 1. 长包逻辑（一包包含480字节音频数据），等待响应ack（5D03）
    case audioSendACK = 0x5D03
    case reportPlayStatus = 0x5D04 // 上报一包tts数据播放状态信息
    case audioSendStop = 0x5D05 // 打断耳机播放tts
    case startRecord = 0x5D06 // 控制 mic 采集音频
    case reportKeysInfomation = 0x5D07 // 上报按键事件
    case getVolume = 0x5d08 // 获取当前耳机绝对音量
    case setVolume = 0x5d09 // 设置当前耳机绝对音量
    case reportVolume = 0x5d0a // 耳机主动上报绝对音量
    case reportPowerOff = 0x5d0b // 关机上报
    case vibration = 0x5D0C // App 开启马达
    case port = 0x5d0d // App 开启设备串口接收功能
    case powerOff = 0x5d0e // App使能固件关机
    case mode = 0x5d0f // App设置固件工厂/用户模式
    case langResult = 0x5d10 // App告知固件语种切换结果
    case led = 0x5d11 // App设置固件的灯效
    case getMac = 0x551F
    case getSN = 0x550B
    case deviceInformation = 0x5504 // 当前设备状态(被动）
    case getDeviceInformation = 0x5505 // 主动获取设备当前状态
    case getVersion = 0x5500 // 固件版本
}

/// 响应到命令的状态
public enum GaiaCommandStatus: UInt8 {
    /// The command succeeded.
    case success = 0x00
    /// An invalid Command ID was specified.
    case failedNotSupported = 0x01
    /// The host is not authenticated.
    case failedNotAuthenticated = 0x02
    /// The device could not carry out the command.
    case failedInsufficientResources = 0x03
    /// The device is authenticating the host.
    case authenticating = 0x04
    /// An invalid parameter was used.
    case invalidParameter = 0x05
    /// The device is not in the correct state.
    case incorrectState = 0x06
    /// The command is in progress.
    case inProgress = 0x07
    /// No status available.
    case noStatusAvailable = 0xFF
}
